envlist = {}
envlist['x64'] = DefaultEnvironment()

cv500_prefix='arm-himix100-linux-'
cv500_toolchain = {
	"CC":	cv500_prefix +'gcc',
	"CXX":	cv500_prefix +'g++',
	"LD":	cv500_prefix +'g++',
	"AR":	cv500_prefix +'ar',
	"STRIP":cv500_prefix +'strip',
}
envlist['cv500'] = Environment(**cv500_toolchain)
envlist['cv500'].AppendENVPath('PATH','/opt/hisi-linux/x86-arm/arm-himix100-linux/bin/')

key = ARGUMENTS.get('env', 'x64')
if key not in envlist.keys():
	print('"%s" not in supported envlist' % key, envlist.keys())
	Exit(1)

Help("support env val: " + str(envlist.keys()))

env = envlist[key]

VariantDir(key, '.', duplicate=False)

# build directory for variant
dst=key+'/'

for src in Glob('*.c'):
	file=str(src)
	if file == 'test_timer.c':
		env.Program(dst+file, LIBS='rt')
	else:
		env.Program(dst+file)

#env.Program(dst+'test_getenv.c')
#env.Program(dst+'test_printf.c')
#env.Program(dst+'test_scanf.c')
#env.Program(dst+'test_sockip.c')
#env.Program(dst+'test_top_cmd.c')
#env.Program(dst+'test_vfork.c')
#env.Program(dst+'test_wireless.c')
#env.Program(dst+'udp_recv.c')
#env.Program(dst+'test_timer.c', LIBS='rt')

